/*
 * PanelLed.h
 *
 *  Created on: Dec 23, 2011
 *      Author: kylintse
 */

#ifndef PANELLED_H_
#define PANELLED_H_

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>

//#include "gdata.h"
#include "kthread.h"

class SwitchStatus : public kthread
{
public:
	SwitchStatus(int ledFd,QObject* parent=0);
	virtual ~SwitchStatus();

protected:
	virtual void run();

private:
	int m_ledFd;
	const int* m_port_g;
	const int* m_port_100m;
	int* m_port_g_status;
	int* m_port_100m_status;
	int m_port_g_num,m_port_100m_num;

	quint32 m_switchCheckCount;
	quint32 m_switchCheckFreq;
};

class PanelLed : public kthread
{
	Q_OBJECT
public:
	PanelLed(QObject* parent=0);
	virtual ~PanelLed();

public:
	void flashLed(int id,quint32 time);
	void turnOffLed(int id);

protected:
	virtual void run();

protected slots:
	void checkLedStatus();
	void switchStatus();
	void winkLed();

private:
	int m_ledFd;
	const int* m_port_g;
	const int* m_port_100m;
	int* m_port_g_status;
	int* m_port_100m_status;
	int m_port_g_num,m_port_100m_num;

	quint32 m_switchCheckCount;
	quint32 m_switchCheckFreq;

	quint32 m_ledNumber;
	QMap<int,int> m_ledWinkers;
};

#endif /* PANELLED_H_ */
